<template>
  <nut-tabbar :class="['main-nav', `tab-${tabActive}`]" @tab-switch="tabSwitch" v-model:visible="tabActive" :bottom="true" :safe-area-inset-bottom="false">
    <nut-tabbar-item tab-title="首页" img="" activeImg="https://7869-xiaofang-2g1dlrqbc66e0f24-1331027538.tcb.qcloud.la/nav_home.png" name="home"></nut-tabbar-item>
    <nut-tabbar-item tab-title="活动规则" img="" activeImg="https://7869-xiaofang-2g1dlrqbc66e0f24-1331027538.tcb.qcloud.la/nav_rule.png" name="rule"></nut-tabbar-item>
    <nut-tabbar-item tab-title="个人中心" img="" activeImg="https://7869-xiaofang-2g1dlrqbc66e0f24-1331027538.tcb.qcloud.la/nav_my.png" name="my"></nut-tabbar-item>
  </nut-tabbar>
</template>

<script setup>
import {ref} from 'vue';
import Taro from "@tarojs/taro";
import home from './home.vue'
const props = defineProps(['defaultTab'])
const tabActive = props.defaultTab

function tabSwitch(tab) {
  Taro.redirectTo({
    url: `/pages/${tab.name}/index`,
  });
}

</script>

<style lang="scss">
.main-nav {
  padding-top: 14px;
  padding-bottom: 14px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-image: url("https://7869-xiaofang-2g1dlrqbc66e0f24-1331027538.tcb.qcloud.la/nav_bg.png");
}

.nut-tabbar-item__icon--unactive .nut-tabbar-item_icon-box_icon {
  display: none;
}

.main-nav .nut-tabbar-item_icon-box {
  width: 100px;
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 8px;
  border-radius: 38rpx 38rpx 38rpx 38rpx;
  border: 3rpx solid #EE5E42;
}
.main-nav .nut-tabbar-item__icon--unactive .nut-tabbar-item_icon-box {
  border-width: 0;
}
.main-nav .nut-tabbar-item_icon-box_nav-word {
  margin-top: 0;
  font-size: 15px;
  font-weight: bold;
  color: #DF3342;
}
</style>
